package at.ac.univie.zsu.aguataplan.domain;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.OneToMany;

/**
 * @author gerry
 * 
 */
@Entity
public class TournamentLocation extends Location {

	@OneToMany(cascade = CascadeType.ALL)
	private Set<Tournament> refTournament = new HashSet<Tournament>();

	// ----------------------------------------------------
	// CONSTRUCTOR
	// ----------------------------------------------------

	public TournamentLocation() {
	}

	// ----------------------------------------------------
	// METHODS
	// ----------------------------------------------------

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("City: ").append(getCity()).append(", ");
		sb.append("Description: ").append(getDescription()).append(", ");
		sb.append("Id: ").append(getId()).append(", ");
		sb.append("Name: ").append(getName()).append(", ");
		sb.append("RefTournament: ")
				.append(getRefTournament() == null ? "null"
						: getRefTournament().size()).append(", ");
		sb.append("Street: ").append(getStreet()).append(", ");
		sb.append("Version: ").append(getVersion()).append(", ");
		sb.append("ZIP: ").append(getzIP());
		return sb.toString();
	}

	// ----------------------------------------------------
	// GETTER & SETTER
	// ----------------------------------------------------

	public Set<Tournament> getRefTournament() {
		return refTournament;
	}

	public void setRefTournament(Set<Tournament> refTournament) {
		this.refTournament = refTournament;
	}

}
